#!/usr/bin/env bash

set -eu

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cd "${__dir}/.."
echo "Current directory is ${PWD}"

CONFIGURATION=debug

set -x

# Perform package update in order to get the latest commits for the dependencies.
swift package update
swift build -c $CONFIGURATION
swift test -c $CONFIGURATION --parallel --enable-test-discovery

# FIXME: Disabled until we get some version of Xcode 11.4 on Swift CI.
#
# Run the integration tests with just built SwiftPM.
# export SWIFTPM_BIN_DIR=$(swift build -c $CONFIGURATION --show-bin-path)
# cd IntegrationTests
# $SWIFTPM_BIN_DIR/swift-test --parallel --enable-test-discovery
